package MyProperties;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

public class demo {
    public static void main(String[] args) throws IOException {
        //先创建好 Properties 容器
        Properties properties = new Properties();
        //再通过setProperty方法先将数据写到容器中
        properties.setProperty("用户","密码");
        properties.setProperty("小明","123");
        properties.setProperty("小板","456");
        properties.setProperty("小童","789");
        //接着通过store方法将容器里的内容写到属性文件中
        properties.store(new FileWriter("D:\\software\\code\\2023_java\\2023_java_code\\code_24_4_29\\src\\MyProperties\\text.properties"),"这是一个注释");

    }
}
